public class Demo3 {
    public static void main(String[] args) {
        Object object = new Object();
        Thread t2 = new Thread(()->{
            synchronized (object){
                System.out.println("t2 notify 之前");
                object.notify();
                System.out.println("t2 notify 之后");
            }
        });
        t2.start();
        try {
            t2.join();
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        Thread t1 = new Thread(()->{
            synchronized ( object){
                System.out.println("t1 wait 之前");
                try {
                    object.wait();
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                System.out.println("t1 wait 之后");
            }
    });
        t1.start();
}
}
